/*
* texture array allow multiple textures bound in single drawcall
*/
#pragma once

#include "defines.h"
#include "platform/vk/vk_device_context.h"

namespace vkrender
{
    class VulkanTextureArray
    {
    private:
        std::shared_ptr<VulkanDeviceContext> context;
        uint32_t num_textures;
        uint32_t max_textures;
        uint32_t width;
        uint32_t height;

        VkImage imageArray;
        VkDeviceMemory imageArrayMemory;
        VkImageView imageArrayView;
    public:
        VulkanTextureArray(const std::shared_ptr<VulkanDeviceContext>& context, 
            uint32_t width, uint32_t height, uint32_t max_textures = 8);
        
        ~VulkanTextureArray();

        bool addTexture(const std::string& texturePath);
        VkImageView getImageView() const { return imageArrayView; }

    private:
        void init();
        VkImageCreateInfo defaultImageCreateInfo(uint32_t w, uint32_t h, uint32_t num_layers);
    };

}
